#ifndef DARV_OGREAPP_HPP
#define DARV_OGREAPP_HPP

#include <Ogre.h>
#include <OgreFrameListener.h>
#include <OgreWindowEventUtilities.h>
#include <EventListener.hpp>

#include <iostream>

namespace DARV {

class OgreApp : public Ogre::FrameListener, public Ogre::WindowEventListener
{
public:

	OgreApp();
	~OgreApp();

	bool init();
	void run(void);

	virtual void createSceneManager(void);
	virtual void createCamera(void);
	virtual void createViewport(void);
	virtual void createScene(void) = 0;
	virtual void destroyScene(void) {}

	/* Méthodes virtuelles héritées de Ogre::FrameListener */
	virtual bool frameStarted(const Ogre::FrameEvent& evt);
	virtual bool frameEnded(const Ogre::FrameEvent& evt);

	/* Méthodes virtuelles héritées de Ogre::WindowEventListener */
	void windowResized(Ogre::RenderWindow* win);
	void windowClosed(Ogre::RenderWindow* win);
	
private:

	void setupResources(void);
	void loadResources(void);

	void createFrameListener(void);
	void createEventListener(void);

public:
	
	Ogre::Root* mRoot;
	Ogre::RenderWindow* mWindow;
	Ogre::SceneManager* mSceneMgr;
	Ogre::Camera* mCamera;
	Ogre::Viewport* mViewport;

	EventListener* mEventListener;

};

}

#endif
